#include "../maininclude.h"

using namespace std;

class MinStack {
private:
    stack<long long> s;
    long long min1=INT_MAX;
public:
    MinStack() {
    }
    
    void push(long long val) {
        if(s.empty())
        {
            s.push(0);
            min1=val;
        }
        else
        {
            long long diff=val-min1;
            s.push(diff);
            if(diff<0)
            {
                min1=val;
            }
        }
    }
    
    void pop() {
        if(s.top()<0)  min1-=s.top();
        s.pop();
    }
    
    long long top() {
        if(s.top()<0)  return min1;
        else return min1+s.top();
    }
    
    long long getMin() {
        return min1;
    }
};

int main()
{
    return 0;
}